﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DanGao.Web.Areas.Manage.Controllers
{
    public class BaseController : Controller
    {

        protected override void OnAuthorization(AuthorizationContext filterContext)
        {
            base.OnAuthorization(filterContext);

            //判断是否，未登录拒绝访问，注意：Session可能会丢失可以加上获取cookie双重保证
            var admin = Session["User"] as Admin;
            if (admin == null)
            {
                filterContext.HttpContext.Response.StatusCode = 403;
            }
        }

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
        }
    }
}
